package org.jradweb.core.orm;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

import org.hibernate.Query;

/**
 * Generic DAO (Data Access Object) with common methods to CRUD POJOs.
 *
 * <p>Extend this interface if you want typesafe (no casting necessary) DAO's for your
 * domain objects.
 * 
 * Created On 2007-10-20
 *
 * @author <a href="mailto:wagzhi@gmail.com">Paul Wang</a>
 * @version $Id: GenericDao.java 43 2008-03-05 01:17:03Z wagzhi $
 * @param <T> a type variable
 * @param <PK> the primary key for that type
 */
public interface GenericDao <T, PK extends Serializable> {

	/**
	 * 
	 * @param object
	 */
	public abstract void persist(T object);

	public abstract void attachDirty(T object);

	public abstract void attachClean(T object);

	public abstract void delete(T object);

	public abstract T merge(T Object);

	public abstract T findById(PK id);

	public abstract List<T> findByExample(T instance);

	public T getUniqueResultByCondition(String condition,Map<String,Object> params);

	public List<T> getPage(int pageNumber,int pageSize);
	
	public List<T> getPage(int pageNumber, int pageSize, String condition, Map<String,Object> params);

	public int getPageCount(int pageSize, String condition, Map<String,Object> params);

	public long getTotalCount();

	public long getCountByCondition(String condition, Map<String,Object> params);

	public List<T> getAll();

	public List<T> getByCondition(String condition, Map<String,Object> params);
    
}